package com.inexas.cu.server.pipe;

import com.google.gwt.user.server.rpc.*;
import com.google.inject.*;
import com.inexas.cu.client.pipe.*;
import com.inexas.cu.server.pipe.ServiceRegistry.*;

@Singleton
public class PipeServerEndImpl extends RemoteServiceServlet implements PipeServerEnd {
	private static final long serialVersionUID = 4641004136308262815L;
	private final ServiceRegistry registry;

	@Inject
	public PipeServerEndImpl(ServiceRegistry registry) {
		this.registry = registry;
	}

	public AbstractResponse process(AbstractRequest request) {
		return registry.fire(request);
	}

	public void register(Class<? extends AbstractRequest> piped, ServiceProvider handler) {
		registry.register(piped, handler);
    }

	public void register(Class<? extends AbstractRequest> piped, ServiceObserver handler) {
		registry.register(piped, handler);
    }

}
